#pragma once

#include <algorithm>
#include <vector>

namespace jianzhi_046
{

class Solution {
public:
    int translateNum(int num) {
        std::vector<int> digits;
        do {
            digits.push_back(num % 10);
            num /= 10;
        } while (num > 0);

        int last_ways = 1;
        int last_ways2 = 1;
        for (int i = 1; i < (int)digits.size(); ++i) {
            int ways = last_ways;
            if ( digits.at(digits.size() - i) > 0 && 
                 digits.at(digits.size() - i) * 10 + digits.at(digits.size() - i - 1) < 26)
                ways += last_ways2;
            last_ways2 = last_ways;
            last_ways = ways;
        }
        return last_ways;
    }
};

}  /* namespace jianzhi_046 */
